package weibo.common.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class JsonResult {

    private Integer status;
    private String message;
    private Object data;

    public JsonResult (StatusCode statusCode,Object data){
        this.status = statusCode.getStatus();
        this.message = statusCode.getMessage();
        this.data = data;
    }
    public JsonResult (StatusCode statusCode){
        this(statusCode,null);
    }

    public static JsonResult success(Object data){
        return new JsonResult(StatusCode.OPERATION_SUCCESS,data);
    }
    public static JsonResult success(){
        return success(null);
    }


}
